package com.lims.admin.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.*;

import javacommon.base.*;


/**
 * @author zzh
 * @version 1.0
 * @since 1.0
 */@Entity
@Table(name = "t_dictables") @SuppressWarnings("unchecked")
public class Dictables extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "Dictables";
	public static final String ALIAS_OBJID = "objid";
	public static final String ALIAS_TAB_NAME = "tabName";
	public static final String ALIAS_CHINESE_NAME = "chineseName";
	public static final String ALIAS_DESCRIBE = "describe";
	public static final String ALIAS_TABLE_TYPE = "tableType";
	
	//date formats
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * objid       db_column: OBJID 
     */ 	
	@Length(max=32)
	private java.lang.String objid;
    /**
     * tabName       db_column: tabName 
     */ 	
	@Length(max=30)
	private java.lang.String tabName;
    /**
     * chineseName       db_column: chineseName 
     */ 	
	@Length(max=200)
	private java.lang.String chineseName;
    /**
     * describe       db_column: describe 
     */ 	
	@Length(max=150)
	private java.lang.String describe;
    /**
     * tableType       db_column: tableType 
     */ 	
	
	private java.lang.Integer tableType;
	//columns END


	public Dictables(){
	}

	public Dictables(
		java.lang.String objid
	){
		this.objid = objid;
	}

	

	public void setObjid(java.lang.String value) {
		this.objid = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "uuid")
	@Column(name = "OBJID", unique = false, nullable = false, insertable = true, updatable = true, length = 32)
	public java.lang.String getObjid() {
		return this.objid;
	}
	
	@Column(name = "tabName", unique = false, nullable = true, insertable = true, updatable = true, length = 30)
	public java.lang.String getTabName() {
		return this.tabName;
	}
	
	public void setTabName(java.lang.String value) {
		this.tabName = value;
	}
	
	@Column(name = "chineseName", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getChineseName() {
		return this.chineseName;
	}
	
	public void setChineseName(java.lang.String value) {
		this.chineseName = value;
	}
	
	@Column(name = "describe", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getDescribe() {
		return this.describe;
	}
	
	public void setDescribe(java.lang.String value) {
		this.describe = value;
	}
	
	@Column(name = "tableType", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getTableType() {
		return this.tableType;
	}
	
	public void setTableType(java.lang.Integer value) {
		this.tableType = value;
	}
	
	
	private Set diccolumnss = new HashSet(0);
	public void setDiccolumnss(Set<Diccolumns> diccolumns){
		this.diccolumnss = diccolumns;
	}
	
	@JSONField(serialize=false)
	@OneToMany(cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "dictables")
	public Set<Diccolumns> getDiccolumnss() {
		return diccolumnss;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Objid",getObjid())
			.append("TabName",getTabName())
			.append("ChineseName",getChineseName())
			.append("Describe",getDescribe())
			.append("TableType",getTableType())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getObjid())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof Dictables == false) return false;
		if(this == obj) return true;
		Dictables other = (Dictables)obj;
		return new EqualsBuilder()
			.append(getObjid(),other.getObjid())
			.isEquals();
	}
}

